package com.aust.state;

/**
 * 测试join方法
 */
public class TestJoin implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("VIP" + i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        /**
         * 启动线程
         */
        TestJoin testJoin = new TestJoin();
        Thread t1 = new Thread(testJoin);
        t1.start();
        for (int i = 0; i < 1000; i++) {
            if (i == 200) {
                /**
                 * t1线程插入主线程中
                 * 200时t1线程插入
                 */
                t1.join();
            }
            System.out.println("main" + i);
        }
    }
}
